import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { InsInsureVO, InsInsureForm, InsInsureQuery } from '@/api/bzIns/insInsure/types';

/**
 * 查询保单记录列表
 * @param query
 * @returns {*}
 */

export const listInsInsure = (query?: InsInsureQuery): AxiosPromise<InsInsureVO[]> => {
  return request({
    url: '/bzIns/insInsure/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询保单记录详细
 * @param insureId
 */
export const getInsInsure = (insureId: string | number): AxiosPromise<InsInsureVO> => {
  return request({
    url: '/bzIns/insInsure/' + insureId,
    method: 'get'
  });
};

/**
 * 新增保单记录
 * @param data
 */
export const addInsInsure = (data: InsInsureForm) => {
  return request({
    url: '/bzIns/insInsure',
    method: 'post',
    data: data
  });
};

/**
 * 修改保单记录
 * @param data
 */
export const updateInsInsure = (data: InsInsureForm) => {
  return request({
    url: '/bzIns/insInsure',
    method: 'put',
    data: data
  });
};

/**
 * 删除保单记录
 * @param insureId
 */
export const delInsInsure = (insureId: string | number | Array<string | number>) => {
  return request({
    url: '/bzIns/insInsure/' + insureId,
    method: 'delete'
  });
};
